Application memory protection using a host page table switching virtual machine function

ABSTRACT

A hypervisor generates first and second page views, where a guest physical address points to a first page of the first page view and a second page of the second page view. A first pointer value is written to the first page and a second pointer value is written to the second page. A guest operating system executes a first task and if a determination to switch to the second task is made, the guest operating system reads a current pointer value and determines what the current page view is. If the guest operating system determines that the current page view is the first page view, the guest operating system saves the first pointer value in a first memory of the first task, loads the second pointer value from a second memory of the second task, and executes a virtual machine function to switch to the second page view.

BACKGROUND

Virtualization may be used to provide some physical components aslogical objects in order to allow running various software modules, forexample, multiple operating systems, concurrently and in isolation fromother software modules, on one or more interconnected physical computersystems. Virtualization allows, for example, consolidating multiplephysical servers into one physical server running multiple virtualmachines in order to improve the hardware utilization rate.

Virtualization may be achieved by running a software layer, oftenreferred to as a hypervisor, above the hardware and below the virtualmachines. A hypervisor may run directly on the server hardware withoutan operating system beneath it or as an application running on atraditional operating system. A hypervisor may virtualize the physicallayer and provide interfaces between the underlying hardware and virtualmachines. Processor virtualization may be implemented by the hypervisorscheduling time slots on one or more physical processors for a virtualmachine, rather than a virtual machine actually having a dedicatedphysical processor.

One vulnerability in virtualized systems is due to malware attacks thatattempt to discover and exploit application memory. For example, thismay occur when application pointers are exposed in the course ofexecution. The present disclosure seeks to increase the robustness ofvirtualized systems to such malware attacks.

SUMMARY

The present disclosure provides a new and innovative system, methods andapparatus for application memory protection using a host page tableswitching virtual machine function.

A system includes a memory, one or more processors, in communicationwith the memory, a virtual machine, including a guest operating system,executing on the one or more processors, and a hypervisor executing onthe one or more processors. The hypervisor generates a first page viewand a second page view, where a guest physical address of the virtualmachine points to a first page of the first page view and a second pageof the second page view. The first page of the first page view isinitialized with a first pointer value and the second page of the secondpage view is initialized with a second pointer value. The guestoperating system executes a first task and then determines whether toswitch to a second task. If the guest operating system makes adetermination to switch from the first task to the second task, theguest operating system reads a current pointer value pointed to by theguest physical address, where the current pointer value is either thefirst pointer value or the second pointer value. The guest operatingsystem then determines what the current page view is based on thecurrent pointer value, where the current page view is either the firstpage view or the second page view. If the guest operating systemdetermines that the current page view is the first page view, the guestoperating system saves the first pointer value in a first memory of thefirst task, loads the second pointer value from a second memory of thesecond task, and executes a virtual machine function, where the virtualmachine function receives the second pointer value as a parameter and,when executed, switches to the second page view.

A system includes a memory, one or more processors, in communicationwith the memory, a virtual machine, including a guest operating system,executing on the one or more processors, and a hypervisor executing onthe one or more processors. The hypervisor generates a first host pagetable and a second host page table. Responsive to generating the firsthost page table, the hypervisor generates a first host page tablepointer and a second host page table pointer, where the first and thesecond host page table pointers are initialized to point to the firsthost page table. A first request to protect a first page viewcorresponding to the first host page table is received from a firstapplication running on the virtual machine. Responsive to receiving thefirst request, the hypervisor determines whether to grant the firstrequest. If the hypervisor makes a determination to grant the firstrequest, the hypervisor modifies at least one access status parameter ofthe first page view corresponding to the first host page table.Responsive to modifying the at least one access status parameter, thehypervisor modifies the second host page table pointer to point to thesecond host page table, where a second page view corresponds to thesecond host page table. Then the hypervisor provides to the guestoperating system a first pointer value corresponding to the first hostpage table pointer and a second pointer value corresponding to thesecond host page table pointer.

Additional features and advantages of the disclosed method and apparatusare described in, and will be apparent from, the following DetailedDescription and the Figures.

BRIEF DESCRIPTION OF THE FIGURES

FIG. 1 is a block diagram of an example multiprocessor computer systemaccording to an example embodiment of the present disclosure.

FIG. 2 a block diagram of example protected and unprotected host pagetables according to an example embodiment of the present disclosure.

FIG. 3 is a block diagram of example protected and unprotected pageviews according to an example embodiment of the present disclosure.

FIG. 4 is a flowchart illustrating an example process for applicationmemory protection using a host page table switching virtual machinefunction according to an example embodiment of the present disclosure.

FIG. 5 is a flow diagram illustrating an example process for applicationmemory protection using a host page table switching virtual machinefunction according to an example embodiment of the present disclosure.

FIG. 6 is a flowchart illustrating an example process for applicationmemory protection using a host page table switching virtual machinefunction according to an example embodiment of the present disclosure.

DETAILED DESCRIPTION OF EXAMPLE EMBODIMENTS

FIG. 1 depicts a high-level component diagram of an examplemulti-processor computer system 100 for application memory protectionusing a host page table switching virtual machine function according toan example embodiment of the present disclosure.

Corruption of application memory in virtualized systems may occur as aresult of malware attacks. Specifically, malicious software may exploitvulnerabilities in which host page table pointers are exposed in thecourse of executing applications 198A-D running on virtual machines170A-D. For example, the malware may acquire access to sensitiveapplication data through these exposed pointers. The present disclosureseeks to reduce these risks in a manner that reduces performanceoverhead. For example, the hypervisor 180 may set up multiple host pagetable pointers that are initialized to point to a first host page table181. If an application 198A makes a request for access to a first pageview corresponding to the host page table 181 to be restricted, thehypervisor 180 may grant this request to protect the first page viewupon determining that the request should be granted. In an exampleembodiment, a second unprotected page view corresponding to a secondhost page table 182 is provided. Then, if the application 198Adetermines that access to the second unprotected page is required, forexample, to process a different task, the application 198A may execute avirtual machine function 183 that selects the second unprotected pageview. In this manner, an unprotected page view is only accessible whenrequired. Additional features and advantages of the disclosed method,system, and apparatus are described below.

The computer system 100 may include one or more interconnected nodes110A-D. Each node 110A-B may in turn include one or more physicalprocessors (e.g., CPU 120A-C) communicatively coupled to memory devices(e.g., MD 130A-C) and input/output devices (e.g., I/O 140A-B). Each node110C-D may include a hardware device 150A-B. In an example embodiment, ahardware device (e.g., 150A-B) may include a network device (e.g., anetwork interface controller (NIC), a network adapter, or any othercomponent that connects a computer to a computer network), a peripheralcomponent interconnect (PCI) device, storage devices, sound or videoadaptors, photo/video cameras, printer devices, keyboards, displays,etc.

As used herein, physical processor or processor 120A-C refers to adevice capable of executing instructions encoding arithmetic, logical,and/or I/O operations. In one illustrative example, a processor mayfollow Von Neumann architectural model and may include an arithmeticlogic unit (ALU), a control unit, and a plurality of registers. In afurther aspect, a processor may be a single core processor which istypically capable of executing one instruction at a time (or process asingle pipeline of instructions), or a multi-core processor which maysimultaneously execute multiple instructions. In another aspect, aprocessor may be implemented as a single integrated circuit, two or moreintegrated circuits, or may be a component of a multi-chip module (e.g.,in which individual microprocessor dies are included in a singleintegrated circuit package and hence share a single socket). A processormay also be referred to as a central processing unit (CPU).

As discussed herein, a memory device 130A-C refers to a volatile ornon-volatile memory device, such as RAM, ROM, EEPROM, or any otherdevice capable of storing data. As discussed herein, I/O device 140A-Brefers to a device capable of providing an interface between one or moreprocessor pins and an external device capable of inputting and/oroutputting binary data.

Processors 120A-C may be interconnected using a variety of techniques,including a point-to-point processor interconnect, and a system areanetwork, such as an Ethernet-based network. Local connections withineach node 110A-D, including the connections between a processor 120A anda memory device 130A-B and between a processor 120A and an I/O device140A may be provided by one or more local buses of suitablearchitecture, for example, peripheral component interconnect (PCI). Asused herein, a device of the host OS 186 (or “host device”) may refer toCPU 120A-C, MD 130A-C, I/O 140A-B, a software device, and/or hardwaredevice 150A-B.

As noted above, computer system 100 may run multiple virtual machines(e.g., VM 170A-D), by executing a software layer (e.g., hypervisor 180)above the hardware and below the virtual machines 170A-D, asschematically shown in FIG. 1. In an example embodiment, the hypervisor180 may be a component of the host operating system 186 executed by thecomputer system 100. In another example embodiment, the hypervisor 180may be provided by an application running on the operating system 186,or may run directly on the computer system 100 without an operatingsystem beneath it. The hypervisor 180 may virtualize the physical layer,including processors, memory, and I/O devices, and present thisvirtualization to virtual machines 170A-D as devices, including virtualprocessors (e.g., VCPU 190A-D), virtual memory devices (e.g., VIVID192A-B), and/or virtual I/O devices (e.g., VI/O 194A-D).

In an example embodiment, a virtual machine 170A-B may execute a guestoperating system 196A-B which may utilize the underlying VCPU 190A-D,VIVID 192A-B, and VI/O devices 194A-D. One or more applications 198A-Dmay be running on a virtual machine 170A-B under the guest operatingsystem 196A-B. The virtual machine 170A-B may include a device register197A-B. As used herein, a device register 197A-B refers to aconfiguration space of a device. In an example embodiment, a device maybe a device (e.g., VCPU 190A-D, VIVID 192A-B, VI/O devices 194A-D,virtual device 172A-B, etc.) of a guest operating system 196A-B (thatis, a “guest device”). In an example embodiment, the guest operatingsystem 196A-B may include a set of guest physical addresses (“GPA”)197A-D.

A virtual machine 170A-B may run any type of dependent, independent,compatible, and/or incompatible applications on the underlying hardwareand OS 186. In an example embodiment, applications (e.g., App 198A-D)executing on a virtual machine 170A-B may be dependent on the underlyinghardware and/or OS 186. In another example embodiment, applications198A-D executing on a virtual machine 170A-B may be independent of theunderlying hardware and/or OS 186. For example, applications 198A-Bexecuting on a first virtual machine 170A may be dependent on theunderlying hardware and/or OS 186 while applications 198C-D executing ona second virtual machine 170B are independent of the underlying hardwareand/or OS 186. Additionally, applications 198A-D executing on a virtualmachine 170A-B may be compatible with the underlying hardware and/or OS186. In an example embodiment, applications 198A-D executing on avirtual machine 170A-B may be incompatible with the underlying hardwareand/or OS 186. For example, applications 198A-B executing on one virtualmachine 170A may be compatible with the underlying hardware and/or OS186 while applications 198C-D executing on another virtual machine 170Bmay be incompatible with the underlying hardware and/or OS 186. In anexample embodiment, a device may be implemented as a virtual machine170.

In an example embodiment, a virtual machine 170A-B may include multiplevirtual processors (VCPU) 190A-D. Processor virtualization may beimplemented by the hypervisor 180 scheduling time slots on one or morephysical processors 120A-C such that from the guest operating system'sperspective those time slots are scheduled on a virtual processor190A-D.

In another example embodiment, a virtual machine 170C-D may includevirtual devices 172A-B. A virtual device 172A-B may provide thefunctionality of traditional hardware devices such as network devices,PCI devices, storage devices, sound or video adaptors, photo/videocameras, printer devices, keyboards, displays, etc.

The hypervisor may also include one or more host page tables such as aprotected host page table 181 and an unprotected host page table 182. Inan example embodiment, the host page table may be an extended page table(“EPT”), translating guest physical addresses to host physicaladdresses. In another embodiment, the host page table may be the shadowpage table translating the guest virtual addresses to host physicaladdresses. In another embodiment, the host page table may be thehypervisor page table, translating the guest physical addresses tohypervisor virtual addresses. Example embodiments of these datastructures are described in greater detail below and as shown in FIG. 2.

FIG. 2 illustrates a protected host page table (otherwise referred to asa page table) 181 and an unprotected host page table 182 according to anexample embodiment of the present disclosure. In general, the hypervisor180 manages the memory usage of the VMs 170A-D. Both virtual memory andphysical memory may be divided into pages 310A-D which are identifiedwith a unique number (e.g., Page Frame Number (PFN) 210A-D and/or260A-D). Example embodiments of pages (e.g., 310A-D and/or 360A-D) andpage views (e.g., 300 and/or 350) are described in greater detail belowand as shown in FIG. 3.

A host page table 181-182 is a data structure used by the hypervisor 180to store a mapping of addresses of the guest OS 196A-B to addresses ofthe host OS 186 (e.g., physical resources of the computer system 100).Accordingly, address translation is handled using the host page tables181-182. For example, the guest OS 196A-B operating within the VMs170A-D may be given the impression that there is a contiguous section ofguest memory available, when in reality, the available guest memory maybe spread across various memory devices 130A-C. In an exampleembodiment, a host page table 181-182 may be an extended page table thattranslates guest physical addresses to host physical addresses. Inanother embodiment, a host page table 181-182 may be a shadow page tablethat translates guest virtual addresses to host physical addresses. Inan example embodiment, a host page table 181-182 may be a hypervisorpage table, translating the guest physical addresses to hypervisorvirtual addresses.

A host page table 181-182 comprises page entries (e.g., 200A-D and/or250A-D) that map PFN (e.g., 210A-D and/or 260A-D), for example anaddress of the guest OS 196A-B, with an address (e.g., 230A-D and/or280A-D), for example an address of the host OS 186. Host page tables181-182 may be used together with any paging data structure used by theVMs 170A-D to support translation from guest OS 196A-B to host OS 186addresses (e.g., 32-bit linear address space using a two-levelhierarchical paging structure, Physical Address Extension mode, INTELExtended Memory 64 Technology mode, etc.). In an example embodiment,host page tables 181-182 may include access status parameters (e.g.,220A-D and/or 270A-D) that indicate an access status for each of thepages (e.g., 310A-D and/or 360A-D). In the illustrated exampleembodiment, the addresses (230A-D and 280A-D) correspond to addresses ofan application 198A. In accordance with this, the pages in theillustrated embodiment in FIG. 3 correspond to pages (otherwise referredto as memory block or memory ranges) 310A-D and 360A-D of the sameapplication 198A. In an example embodiment, host page table pointers(e.g., 240 and/or 290) may be associated with each host page table181-182. For example, host page table pointer 240 corresponds toprotected host page table 181 and host page table pointer 290corresponds to unprotected host page table 182.

In an example embodiment, host page tables 181-182 may include an accessstatus parameter (e.g., 220A-D and/or 270A-D). The access statusparameter (e.g., 220A-D and/or 270A-D) indicates the access status of apage (e.g., 310A-D and/or 360A-D) corresponding to the page entry (e.g.,200A-D and/or 250A-D) of the page table 181-182. For example, an accessstatus parameter (e.g., 220A-D and/or 270A-D) may be used to define thata given page (e.g., 310A-D and/or 360A-D) is inaccessible (or noaccess), writable (or read-write), write-protected (or read-only),executable (or executable and readable), executable only, etc. Forexample, as illustrated in the example embodiment in FIG. 2, the page310A corresponding to page entry 200A, PFN 210A address (x0001), address230A (x03FF), and access status parameter 220A has been defined inprotected host page table 181 as ‘No Access’. The hypervisor 180 may beused to modify an access status parameter (e.g., 220A-D and/or 270A-D)of pages (e.g., 310A-D and/or 360A-D). In an example embodiment, avirtual machine 170A-D, guest OS 196A-B, and/or application 198A-D mayuse the mprotect( ) function to request that the hypervisor 180 modifythe access status parameter of a page view or a set of pages.

In the illustrated example embodiment, the protected host page table 181includes a variety of access protections corresponding to the protectedpage view 300 including ‘No Access,’ ‘Executable Only,’ and ‘Read Only.’In an example embodiment, the access protections may all the be same. Inan example embodiment, only a subset of the page entries 200A-D of theprotected host page table 181 have an access protection such as ‘NoAccess,’ ‘Executable Only,’ and ‘Read Only.’ In this manner, only asubset of pages 310A-D of the protected page view 300 are protected. Inthe illustrated example embodiment, the unprotected host page table 182permits every page in the corresponding unprotected page view 350 to beboth read and written to. In an example embodiment, only a subset of thepage entries 250A-D of the unprotected host page table 182 are writable(e.g., provided the access status ‘Read-Write’). In this manner, only asubset of pages 360A-D of the unprotected page view 350 are writable.

In an example embodiment, a page table 181-182 may include additionalinformation not shown in FIG. 2 including a presence identifier,statistics information, background information, dirty identifiers whichindicate that modifications to a page must be written back to disk, etc.

In an example embodiment, one or more page tables 181-182 may bemaintained by the hypervisor 180 which map guest OS 196A-B addresses tohost OS 186 addresses that are accessible by the hypervisor 180, VMs170, guest OS 196A-B, Host OS 186, Host OS 186 resources, and/or VMFunctions 183. The sizes of different page tables may vary and mayinclude more or fewer entries than are illustrated in FIG. 2.

FIG. 3 illustrates protected page view 300 (and corresponding pages310A-D) and unprotected page view 350 (and corresponding pages 360A-D)in accordance with an example embodiment of the present disclosure. Asnoted above, a page (e.g., 310A-D and/or 360A-D) may be a portion ofphysical or virtual memory designated for storing data. As used herein,a page view (e.g., 300 and/or 350) denotes a mapping from addressesdesignated for use by VM 170A-D to host OS 186 addresses. In an exampleembodiment, the page view (e.g., 300 and/or 350) may denote the mappingfrom PFNs of a VM 170A-D to host OS 186 addresses, as used during normalexecution of the VM 170A-D. As illustrated in FIG. 3, pages 310A-D maybe defined by access status parameters in accordance with theirrespective page table 181-182 access status parameters (e.g., 220A-Dand/or 270A-D).

In an example embodiment, the hypervisor 180 may provide one or morevirtual machine functions (VM Functions) 183 to a virtual machine170A-D. In an example embodiment, the VM Function 183 may be invoked fora VM 170A, by the guest OS 196A that is running on the VM 170A. In anexample embodiment, a VM Function 183 may only be invoked if hypervisor180 provides access or grants a request. In an example embodiment, theVM Function may be provided by the host CPU on which the hypervisor isexecuting. In an example embodiment, the VM Function is a host pagetable switching VM function 183. For example, a VM 170A or guest OS 196Amay invoke a VM Function 183 to cause the hypervisor to translate theguest addresses according to the protected host page table or theunprotected host page table. In an example embodiment, a hypervisor 180may grant a VM 170A or guest OS 196A access to a VM Function 183 toallow the VM 170A or guest OS 196A to switch host page tables withoutrequiring an exit to the hypervisor. In an example embodiment, thehypervisor 180 may also deny the request by causing an undefined opcodeexception or a general protection fault exception whenever the VMFunction 183 is invoked.

FIG. 4 illustrates a flowchart of an example method 400 for applicationmemory protection using a host page table switching virtual machinefunction. Although the example method 400 is described with reference tothe flowchart illustrated in FIG. 4, it will be appreciated that manyother methods of performing the acts associated with the method 400 maybe used. For example, the order of some of the blocks may be changed,certain blocks may be combined with other blocks, and some of the blocksdescribed are optional. The method 400 may be performed by processinglogic that may comprise hardware (circuitry, dedicated logic, etc.),software, or a combination of both. In an example embodiment, the methodis performed by a hypervisor 180.

The example method 400 starts and the hypervisor 180 generates a firsthost page table 181 and a second host page table 182 (block 410). In anexample embodiment, the first host page table 181 is associated with afirst page view 300 which is used by an application 198A executing on avirtual machine 170A. In an example embodiment, the first host pagetable 181 is initialized such that at least one page entry 200A-D (andcorrespondingly at least one page 310A-D of page view 300) is writable.In an example embodiment, the first host page table 181 is initializedsuch that all the page entries 200A-D (and correspondingly all the pages310A-D of page view 300) are writable. In an example embodiment, thesecond host page table 182 is generated at the same time as the firsthost page table. In another example embodiment, the second host pagetable 182 is generated subsequent to the generation of the first hostpage table 181.

In an example embodiment, the second host page table 182 is initializedto be accessible to the same application 198A as the first host pagetable 181. In an example embodiment, the page view 350 (and/or pages360A-D) corresponding to the second host page table 182 is initializedto be populated with the same data as page view 300 (and/or pages310A-D). In an example embodiment, page view 350 (and/or pages 360A-D)corresponding to the second host page table 182 is not populated withany data until information is requested from the page view 350 (and/orpages 360A-D) at which time it is populated with the same data as pageview 300 (and/or pages 310A-D). In an example embodiment, page view 350(and/or pages 360A-D) corresponding to the second host page table 182 isnot populated with any data until a page fault occurs at which time thepage view 350 (and/or pages 360A-D) is populated with the same data aspage view 300 (and/or pages 310A-D).

Responsive to generating the first host page table 181, the hypervisor180 generates a first host page table pointer 240 and a second host pagetable pointer 290, where the first host page table pointer 240 isinitialized to point to the first host page table 181 and the secondhost page table pointers 290 is initialized to point to the second hostpage table 182 (block 420).

The hypervisor 180 receives from a first application 198A running on avirtual machine 170A, a first request to protect a first page view 300corresponding to the first host page table 181 (block 430). In anexample embodiment, the first application 198A running on the virtualmachine 170A generates the first request to protect the first page view300 corresponding to the first host page table 181 using the mprotect( )function. In an example embodiment, the mprotect( ) function takes asits parameters a memory address range and a protection status that isdesired. For example, the first application 198A may request that theaccess status parameter 220A-D corresponding to page entries 200A-D oraddresses 230A-D be modified to be read-only. In this exampleembodiment, if the request is granted by the hypervisor 180, pages310A-D will be read only. In an example embodiment, the mprotect( )function may take as its parameters a protection status that is desiredand a current page view parameter. In an example embodiment, the currentpage view parameter indicates to the hypervisor 180 that the currentlyaccessed page view 300 as defined by the current host page table pointer240 is requested to be protected. In an example embodiment, the currentpage view parameter is the VM Function 183 parameter called‘PROT_VMFUNC’.

Responsive to receiving the first request, the hypervisor 180 determineswhether to grant the first request (block 440). In an exampleembodiment, the hypervisor 180 may grant the first request if itdetermines that the application 198A is requesting protection of anaddress space that belongs exclusively to the application 198A. In anexample embodiment, the hypervisor 180A may deny the first request if itdetermines that the address space for which protection is requestedbelongs to a different application 198B. In an example embodiment, thehypervisor 180A may deny the first request if it determines that theaddress space for which protection is requested is shared among multipleapplications 198A and 198B. In an example embodiment, the hypervisor180A may deny the first request if it determines that the address spacefor which protection is requested is shared memory.

Responsive to a determination to grant the first request, the hypervisor180 modifies at least one access status parameter 220A-D of the firstpage view 300 corresponding to the first host page table 181 and atleast one access status parameter 270A-D of the second page view 350corresponding to the second host page table 182 (block 450). In anexample embodiment, the hypervisor 180 modifies the at least one accessstatus parameter 270A-D to be writable. In an example embodiment, thehypervisor 180 modifies the at least one access status parameter 220A-Dto be at least one of ‘Read Only,’ ‘Executable Only,’ and ‘No Access’ inaccordance with the parameters passed in the first request. In thismanner, at least one of the pages 310A-D corresponding to the nowprotected host page table 181 may be at least one of ‘Read Only,’‘Executable Only,’ and inaccessible. In an example embodiment, thehypervisor 180 modifies every access status parameter 220A-D to be atleast one of ‘Read Only,’ ‘Executable Only,’ and ‘No Access’ inaccordance with the parameters passed in the first request. In thismanner, every one of the pages 310A-D corresponding to the now protectedhost page table 181 may be at least one of ‘Read Only,’ ‘ExecutableOnly,’ and inaccessible. In an example embodiment, in granting the firstrequest, the hypervisor 180 sets a flag that triggers a page faultwithin the guest OS 196A of the virtual machine 170A (whichcorrespondingly detects the page fault) if the page view 300corresponding to the now protected host page table 181 is attempted tobe accessed in violation of the access status parameters 220A-D. Forexample, the hypervisor 180 grants the first request and sets the accessstatus parameter 220A to ‘Read Only’ and an application 198A-Dsubsequently attempts to write to page 310A, the flag set by thehypervisor 180 will trigger and cause a page fault within the guest OS196A of the virtual machine 170A (which will correspondingly detect thepage fault). In this manner, performance overhead is reduced bytriggering a page fault rather than causing an exit to the hypervisor180.

In an example embodiment, rather than triggering a page fault, if thepage view 300 corresponding to the now protected host page table 181 isaccessed in violation of the access status parameters 220A-D, an exit tothe hypervisor 180 is triggered. The hypervisor 180 may then send aninterrupt to the guest OS 196A of the virtual machine 170A to triggerthe page fault.

In an example embodiment, the hypervisor 180 generates the unprotectedsecond host page table 182 and unprotected page view 350 upon grantingthe first request. In an example embodiment, at least one of the accessstatus parameters 270A-D corresponding to the unprotected second hostpage table 182 are initialized to be writable (‘Read-Write’). In thismanner, at least one of the pages 360A-D corresponding to theunprotected second host page table may be writable. In an exampleembodiment, every one of access status parameters 270A-D correspondingto the second host page table 182 are initialized to be writable(‘Read-Write’). In this manner, every one of the pages 360A-Dcorresponding to the unprotected second host page table may be writable.

In an example embodiment, the hypervisor 180 populates the unprotectedpage view 350 with the same data as the protected page view 300 upongranting the first request. In an example embodiment, the hypervisor 180populates at least one page 360A-D of the unprotected page view 350corresponding to the application 198A with the same data as at least onepage 310A-D of the protected page view 300 corresponding to theapplication 198A upon granting the first request.

In an example embodiment, the hypervisor 180 then writes the firstpointer value corresponding to the first host page table pointer 240into a first page of the first page view 300 and the second pointervalue corresponding to the second host page table pointer 290 into asecond page of the second page view 350 and provides to the virtualmachine 170A (and/or the application 198A/guest OS 196A) the firstpointer value and the second pointer value. In an example embodiment,the first pointer value provided is not the first host page tablepointer 240 and the second pointer value provided is not the second hostpage table pointer 290. For example, the first and second pointer valuesmay be host page table pointer index values corresponding to the hostpage table pointers 240 and 290. In this manner, the host page tablepointers 240 and 290 are kept hidden from the application 198A (and/orthe guest OS 196A/virtual machine 170A) to preserve the security andintegrity of the system. In an example embodiment, the hypervisor 180maintains a mapping between the host page table pointer index values andthe real host page table pointers 240 and 290 using a host page tablepointer data structure.

In an example embodiment, the virtual machine 170A (and/or application198B/guest OS 196A) may write the first pointer value into a first pageof the first page view 300 and the second pointer value into a secondpage of the second page view 350. A guest physical address 197A pointsto the first page of the first page view 300 and the second page of thesecond page view 350.

In an example embodiment, the application 198A (and/or the guest OS196A/virtual machine 170A) may execute a virtual machine function 183,where the virtual machine function 183 receives the second pointer valueas a parameter and, when executed, selects or switches to the secondpage view 350. In an example embodiment, the virtual machine function183 is the VMFUNC EPTP switching instruction. In this manner, thepresent disclosure permits an application 198A (and/or the guest OS196A/virtual machine 170A) to control (i.e. access and switch asdesired) current page view (300 or 350) without exiting to thehypervisor 180. This thereby reduces performance overhead whileimproving system security by reducing the risk of application memorycorruption.

In an example embodiment, the application 198A (and/or the guest OS196A/virtual machine 170A) may execute the virtual machine function 183responsive to determining that switching to the second page view 350 iseither required or desirable. In an example embodiment, the application198A (and/or the guest OS 196A/virtual machine 170A) may determine thatswitching to the second page view 350 is either required or desirableresponsive to determining that the first page view 300 is inappropriatefor a first task. For example, the application 198A (and/or the guest OS196A/virtual machine 170A) may determine that the first task requireswriting to memory of the application 198A and that writing to thecurrent protected first page view 300 would generate a page fault;accordingly, the application 198A (and/or the guest OS 196A/virtualmachine 170A) may switch to a different unprotected second page view 350to facilitate writing to the memory of the application 198A. In anexample embodiment, the application 198A (and/or the guest OS196A/virtual machine 170A) may determine that the first task does notrequire writing to memory of the application 198A and continuing to usethe current unprotected second page view 350 would be undesirable orleave the system vulnerable; accordingly, the application 198A (and/orthe guest OS 196A/virtual machine 170A) may switch to a differentprotected second page view 300 to preclude writing to the memory of theapplication 198A.

In an example embodiment, the application 198A (and/or the guest OS196A/virtual machine 170A) may determine that switching to theunprotected second page view 350 is required responsive to determiningthat the unprotected second page view 350 is appropriate for a secondtask. For example, the application 198A (and/or the guest OS196A/virtual machine 170A) may determine during execution of a firsttask that a second task requires writing to memory of the application198A and that writing to the current protected first page view 300 wouldgenerate a page fault; accordingly, prior to or upon commencingexecution of the second task the application 198A (and/or the guest OS196A/virtual machine 170A) may switch to a different unprotected secondpage view 350 to facilitate writing to the memory of the application198A. In an example embodiment, the application 198A (and/or the guestOS 196A/virtual machine 170A) may determine during execution of a firsttask that a second task does not require writing to memory of theapplication 198A and continuing to use the current unprotected secondpage view 350 upon execution of the second task would be undesirable orleave the system vulnerable; accordingly, prior to or upon commencingexecution of the second task the application 198A (and/or the guest OS196A/virtual machine 170A) may switch to a different protected secondpage view 300 to preclude writing to the memory of the application 198A.

In an example embodiment, the application 198A (and/or the guest OS196A/virtual machine 170A) may include a guest physical address 197Athat points to a page 310A of the current protected first page view 300and a guest physical address 197B that points to a page 360A of adifferent unprotected second page view 350. In an example embodiment,exactly one guest physical address 197A points to two different pages(e.g., 310A and 360A) of two different page views (e.g., 300 and 350).In an example embodiment, the hypervisor 180 or the application 198A(and/or the guest OS 196A/virtual machine 170A) writes the first pointervalue corresponding to the first host page table pointer 240 to the page310A of the current protected first page view 300. In an exampleembodiment, the hypervisor 180 or the application 198A (and/or the guestOS 196A/virtual machine 170A) writes the second pointer valuecorresponding to the second host page table pointer 290 to the page 360Aof the different unprotected second page view 350.

In an example embodiment, the application 198A (and/or the guest OS196A/virtual machine 170A) may provide the virtual machine function 183with the first pointer value to select or switch to the first page view300 responsive to retrieving the first pointer value from the page 310Aof the current protected first page view 300. In an example embodiment,the application 198A (and/or the guest OS 196A/virtual machine 170A) mayprovide the virtual machine function 183 with the second pointer valueto select or switch to the second page view 350 responsive to retrievingthe second pointer value from the page 360A of the different unprotectedsecond page view 350.

In an example embodiment, the application 198A (and/or the guest OS196A/virtual machine 170A) may determine that the first page view 300 isinappropriate for a first task (and/or the second page view 350 isappropriate for a second task) responsive to (a) retrieving the firstpointer value corresponding to the first host page table pointer 240from the page 310A of the current protected first page view 300, (b)storing the first pointer value into the task context of the first (orprevious) task, (c) retrieving the second pointer value corresponding tothe second host page table pointer 290 from the task context of thesecond (or new) task, and (d) determining that the second (or expected)pointer value is different from the first pointer value.

In an example embodiment, the application 198A (and/or the guest OS196A/virtual machine 170A) may determine that the second page view 350is inappropriate for a first task (and/or the first page view 300 isappropriate for a second task) responsive to (a) retrieving the secondpointer value corresponding to the second host page table pointer 290from the page 360A of the current unprotected second page view 350, (b)storing the second pointer value into the task context of the first (orprevious) task, (c) retrieving the first pointer value corresponding tothe first host page table pointer 240 from the task context of thesecond (or new) task, and (d) determining that the second (or expected)pointer value is different from the first pointer value.

In an example embodiment, the application 198A (and/or the guest OS196A/virtual machine 170A) may determine that switching to the secondunprotected page view 350 is required responsive to receiving a pagefault. For example, the application 198A (and/or the guest OS196A/virtual machine 170A) may detect an interrupt from the hypervisor180 or a page fault caused by the application 198A's attempt to write tothe protected page view 300 and indicate to the current task thatswitching to a different unprotected page view 350 is required.

FIG. 5 illustrates a flow diagram of an example method 500 forapplication memory protection using a host page table switching virtualmachine function in accordance with an example embodiment of the presentdisclosure. Although the example method 500 is described with referenceto the flowchart illustrated in FIG. 5, it will be appreciated that manyother methods of performing the acts associated with the method 500 maybe used. For example, the order of some of the blocks may be changed,certain blocks may be combined with other blocks, and some of the blocksdescribed are optional. The method 500 may be performed by processinglogic that may comprise hardware (circuitry, dedicated logic, etc.),software, or a combination of both.

In the illustrated example embodiment, a hypervisor 180 generates afirst host page table 181 (block 505). The hypervisor 180 then generatesa first host page table pointer 240 and a second host page table pointer290, where the first host page table pointer 240 is initialized to pointto the first host page table 181 and the second host page table pointer290 is initialized to point to the second host page table 182 (block510). A virtual machine 170A (and/or application 198B/guest OS 196A)transmits a first request to protect a first page view 300 correspondingto the first host page table 181 (blocks 515 and 520). The hypervisor180 receives the first request and determines whether to grant the firstrequest (block 525). Responsive to a determination to grant the firstrequest, the hypervisor 180 generates a second host page table 182 andmodifies the access status parameters of the first page view 300corresponding to the first host page table 181 to render the pages ofthe first page view 300 read-only (block 530). The hypervisor 180 then

writes a first pointer value corresponding to the first host page tablepointer 240 into a first page of the first page view 300 and a secondpointer value corresponding to the second host page table pointer 290into a second page of the second page view 350 (block 535). Thehypervisor 180 provides to the virtual machine 170A (and/or application198B/guest OS 196A) the first pointer value and the second pointer value(blocks 540 and 545). The virtual machine 170A (and/or application198B/guest OS 196A) receives the first and second pointer values (block550). In an example embodiment, the virtual machine 170A (and/orapplication 198B/guest OS 196A) writes the first pointer value into afirst page of the first page view 300 and the second pointer value intoa second page of the second page view 350. A guest physical address 197Apoints to the first page of the first page view 300 and the second pageof the second page view 350. In an example embodiment, in lieu ofproviding the first and second pointer values to the the virtual machine170A (and/or application 198B/guest OS 196A), the hypervisor 180 writesthe first pointer value into a first page of the first page view 300 andthe second pointer value into a second page of the second page view 350.

The virtual machine 170A (and/or guest OS 196A) executes the application198B with the now protected first page view 300 as the current page view(block 555). The virtual machine 170A (and/or application 198B/guest OS196A) attempts to write first data to the now protected first page view300 (block 560). The virtual machine 170A (and/or application 198B/guestOS 196A) detects a page fault due to attempting to write to theprotected first page view 300 (block 565). The virtual machine 170A(and/or application 198B/guest OS 196A) selects the second page view 350by executing a VM function 183, where the VM function 183 receives thesecond pointer value as a parameter (block 570). The virtual machine170A (and/or application 198B/guest OS 196A) writes the first data tothe unprotected second page view 350 (block 575). The virtual machine170A (and/or application 198B/guest OS 196A) then selects the protectedfirst page view 300 by executing a VM function 183, where the VMfunction 183 receives the first pointer value as a parameter.

FIG. 6 illustrates a flowchart of an example method 600 for applicationmemory protection using a host page table switching virtual machinefunction. Although the example method 600 is described with reference tothe flowchart illustrated in FIG. 6, it will be appreciated that manyother methods of performing the acts associated with the method 600 maybe used. For example, the order of some of the blocks may be changed,certain blocks may be combined with other blocks, and some of the blocksdescribed are optional. The method 600 may be performed by processinglogic that may comprise hardware (circuitry, dedicated logic, etc.),software, or a combination of both. In an example embodiment, the methodis performed by one or more of a hypervisor 180, a virtual machine 170A,a guest OS 196A, and an application 198A.

The example method 600 starts and the hypervisor 180 generates a firstpage view 300 and a second page view 350, where a guest physical address197A of the virtual machine 170A points to a first page 310C of thefirst page view 300 and a second page 360C of the second page view 350(block 610). A first pointer value is then written to the first page310C of the first page view 300 and a second pointer value is written tothe second page 360C of the second page view 350 (block 620). In anexample embodiment, the hypervisor 180 writes the first pointer value tothe first page 310C of the first page view 300 and writes the secondpointer value to the second page 360C of the second page view 350. In anexample embodiment, the virtual machine 170A (and/or application198B/guest OS 196A) writes the first pointer value to the first page310C of the first page view 300 and writes the second pointer value tothe second page 360C of the second page view 350. In an exampleembodiment, the first pointer value corresponds to the first host pagetable pointer 240 and a second pointer value corresponds to the secondhost page table pointer 290.

The virtual machine 170A (and/or application 198B/guest OS 196A)executes a first task (block 630). In an example embodiment, the firsttask is part of a first application 198A. The virtual machine 170A(and/or application 198B/guest OS 196A) determines whether to switch toa second task (block 640). In an example embodiment, the second task ispart of the first application 198A. In an example embodiment, the secondtask is part of a second application 198A.

Responsive to a determination to switch from the first task to thesecond task, the virtual machine 170A (and/or application 198B/guest OS196A) reads a current pointer value pointed to by the guest physicaladdress 197A, where the current pointer value is one of the firstpointer value and the second pointer value (block 650). Responsive toreading the current pointer value, determine a current page view basedon the current pointer value, where the current page view is one of thefirst page view and the second page view (block 660). In an exampleembodiment, the current page view is the page view presently being usedby the virtual machine 170A (and/or application 198B/guest OS 196A).

Responsive to determining that the current page view is the first pageview 300, virtual machine 170A (and/or application 198B/guest OS 196A)saves the first pointer value in a first memory 310C of the first task,load the second pointer value from a second memory 360C of the secondtask, and execute a virtual machine function 183, where the virtualmachine function 183 receives the second pointer value as a parameterand, when executed, selects or switches to the second page view 350(block 670). In an example embodiment, once the virtual machine 170A(and/or application 198B/guest OS 196A) switches to the second page view350, the second page view 350 is the current page view.

It will be appreciated that all of the disclosed methods and proceduresdescribed herein can be implemented using one or more computer programsor components. These components may be provided as a series of computerinstructions on any conventional computer readable medium or machinereadable medium, including volatile or non-volatile memory, such as RAM,ROM, flash memory, magnetic or optical disks, optical memory, or otherstorage media. The instructions may be provided as software or firmware,and/or may be implemented in whole or in part in hardware componentssuch as ASICs, FPGAs, DSPs or any other similar devices. Theinstructions may be configured to be executed by one or more processors,which when executing the series of computer instructions, performs orfacilitates the performance of all or part of the disclosed methods andprocedures.

The example embodiments may be embodied in the form ofcomputer-implemented processes and apparatuses for practicing thoseprocesses. An embodiment may also be embodied in the form of a computerprogram code containing instructions embodied in tangible media, such asfloppy diskettes, CD-ROMs, DVD-ROMs, hard drives, or any other computerreadable non-transitory storage medium, wherein, when the computerprogram code is loaded into and executed by a computer, the computerbecomes an apparatus for carrying out the method. An embodiment may alsobe embodied in the form of computer program code, for example, whetherstored in a storage medium, loaded into and/or executed by a computer,or transmitted over some transmission medium, such as over electricalwiring or cabling, through fiber optics, or via electromagneticradiation, wherein when the computer program code is loaded into andexecuted by a computer, the computer becomes an apparatus for carryingout the method. When implemented on a general-purpose microprocessor,the computer program code segments configure the microprocessor tocreate specific logic circuits.

It should be understood that various changes and modifications to theexample embodiments described herein will be apparent to those skilledin the art. Such changes and modifications can be made without departingfrom the spirit and scope of the present subject matter and withoutdiminishing its intended advantages. It is therefore intended that suchchanges and modifications be covered by the appended claims.

The invention is claimed as follows:
 1. A system comprising: a memory;one or more processors, in communication with the memory; a virtualmachine, including a guest operating system, executing on the one ormore processors; a hypervisor executing on the one or more processors;wherein the one or more processors are configured to: generate, by thehypervisor, a first page view and a second page view, wherein a guestphysical address of the virtual machine points to a first page of thefirst page view and a second page of the second page view.
 2. The systemof claim 1, wherein the one or more processors is further configured to:write a first pointer value to the first page of the first page view anda second pointer value to the second page of the second page view;execute, by the guest operating system, a first task; determine, by theguest operating system, whether to switch to a second task; responsiveto a determination to switch from the first task to the second task,read, by the guest operating system, a current pointer value pointed toby a guest physical address, wherein the current pointer value is one ofthe first pointer value and the second pointer value; responsive toreading the current pointer value, determine, by the guest operatingsystem, a current page view based on the current pointer value, whereinthe current page view is one of the first page view and the second pageview; and responsive to determining that the current page view is thefirst page view: save, by the guest operating system, the first pointervalue in a first memory of the first task; load, by the guest operatingsystem, the second pointer value from a second memory of the secondtask; and execute, by the guest operating system, a virtual machinefunction, wherein the virtual machine function receives the secondpointer value as a parameter and, when executed, switches to the secondpage view.
 3. The system of claim 2, wherein the hypervisor executing onthe one or more processors is further configured to: generate, by thehypervisor, a first host page table and a second host page table;responsive to generating the first host page table, generate, by thehypervisor, a first host page table pointer and a second host page tablepointer, wherein the first host page table pointer is initialized topoint to the first host page table and the second host page tablepointer is initialized to point to the second host page table; receive,from a first application running on the virtual machine, a first requestto protect the first page view corresponding to the first host pagetable; responsive to receiving the first request, determine, by thehypervisor, whether to grant the first request; responsive to adetermination to grant the first request, modify, by the hypervisor, atleast one access status parameter of the first page view correspondingto the first host page table and the second page view corresponding tothe second host page table.
 4. The system of claim 1, wherein thehypervisor executing on the one or more processors is further configuredto write the first pointer value into the first page of the first pageview and the second pointer value into the second page of the secondpage view, and wherein the hypervisor executing on the one or moreprocessors is further configured to provide to the virtual machine thefirst pointer value corresponding to the first host page table pointerand the second pointer value corresponding to the second host page tablepointer.
 5. The system of claim 2, wherein the guest operating systemexecuting on the one or more processors is further configured to writethe first pointer value into the first page of the first page view andthe second pointer value into the second page of the second page view.6. A system comprising: a memory; one or more processors, incommunication with the memory; a virtual machine, including a guestoperating system, executing on the one or more processors; a hypervisorexecuting on the one or more processors; wherein the one or moreprocessors are configured to: generate, by the hypervisor, a first hostpage table and a second host page table; responsive to generating thefirst host page table, generate, by the hypervisor, a first host pagetable pointer and a second host page table pointer, wherein the firsthost page table pointer is initialized to point to the first host pagetable and the second host page table pointer is initialized to point tothe second host page table; receive, from a first application running onthe guest operating system, a first request to protect a first page viewcorresponding to the first host page table; responsive to receiving thefirst request, determine, by the hypervisor, whether to grant the firstrequest; responsive to a determination to grant the first request,modify, by the hypervisor, at least one access status parameter of thefirst page view corresponding to the first host page table and at leastone access status parameter of the second page view corresponding to thesecond host page table.
 7. The system of claim 6, wherein the hypervisorexecuting on the one or more processors is further configured to write afirst pointer value corresponding to the first host page table pointerinto a first page of the first page view and a second pointer valuecorresponding to the second host page table pointer into a second pageof the second page view, and wherein the hypervisor executing on the oneor more processors is further configured to provide to the guestoperating system the first pointer value and the second pointer value.8. The system of claim 6, wherein the guest operating system executingon the one or more processors is further configured to write a firstpointer value corresponding to the first host page table pointer into afirst page of the first page view and a second pointer valuecorresponding to the second host page table pointer into a second pageof the second page view.
 9. The system of claim 7, wherein the guestoperating system executing on the one or more processors is furtherconfigured to execute a virtual machine function, wherein the virtualmachine function receives the second pointer value as a parameter and,when executed, selects the second page view.
 10. The system of claim 7,wherein the guest operating system is further configured to: determinewhether the first page view is inappropriate for a first task;responsive to determining that the first page view is inappropriate forthe first task, determine that switching to the second page view isrequired; and responsive to determining that switching to the secondpage view is required, executing a virtual machine function, wherein thevirtual machine function, when executed, selects the second page view.11. The system of claim 7, wherein the guest operating system is furtherconfigured to: determine whether the second page view is appropriate fora second task; responsive to determining that the second page view isappropriate for the second task, determine that switching to the secondpage view is required; and responsive to determining that switching tothe second page view is required, executing a virtual machine function,wherein the virtual machine function, when executed, selects the secondpage view.
 12. The system of claim 6, wherein the guest operating systemis further configured to: detect a page fault; responsive to detectingthe page fault, determine whether switching to the second page view isrequired; and responsive to determining that switching to the secondpage view is required, executing a virtual machine function, wherein thevirtual machine function, when executed, selects the second page view.13. The system of claim 6, wherein modifying the at least one accessstatus parameter of the first page view renders at least one page of thefirst page view read-only.
 14. The system of claim 6, wherein modifyingthe at least one access status parameter of the first page view rendersat least one page of the second page view writable.
 15. The system ofclaim 6, wherein the second host page table is generated responsive to adetermination to grant the first request.
 16. A method, comprising:generating, by a hypervisor executing on a computer system, a first hostpage table and a second host page table; responsive to generating thefirst host page table, generating, by the hypervisor, a first host pagetable pointer and a second host page table pointer, wherein the firsthost page table pointer is initialized to point to the first host pagetable and the second host page table pointer is initialized to point tothe second host page table; receiving, from a first application runningon the virtual machine, a first request to protect a first page viewcorresponding to the first host page table; responsive to receiving thefirst request, determining, by the hypervisor, whether to grant thefirst request; responsive to a determination to grant the first request,modifying, by the hypervisor, at least one access status parameter ofthe first page view corresponding to the first host page table and atleast one access status parameter of the second page view correspondingto the second host page table.
 17. The method of claim 16, furthercomprising writing, by the hypervisor, a first pointer valuecorresponding to the first host page table pointer into a first page ofthe first page view and a second pointer value corresponding to thesecond host page table pointer into a second page of the second pageview, and providing, by the hypervisor, to the guest operating systemthe first pointer value and the second pointer value.
 18. The method ofclaim 16, further comprising writing, by the guest operating system, afirst pointer value corresponding to the first host page table pointerinto a first page of the first page view and a second pointer valuecorresponding to the second host page table pointer into a second pageof the second page view.
 19. The method of claim 16, wherein modifyingthe at least one access status parameter of the first page view rendersat least one page of the first page view read-only.
 20. The method ofclaim 16, wherein modifying the at least one access status parameter ofthe second page view renders at least one page of the second page viewwritable.